import { _decorator, AudioClip, AudioSource, Button, Component, Node } from 'cc';
import { L } from './L';
import { AudioManager } from './AudioManager';
const { ccclass, property } = _decorator;

@ccclass('ButtonClickAudio')
export class ButtonClickAudio extends Component {
    @property(AudioClip)
    audio: AudioClip = null!;

    start() {
        this.getComponent(Button).node.on(Button.EventType.CLICK, () => {
            L.info(this.node.name, 'ButtonClickAudio....');
            AudioManager.inst.playOneShot(this.audio);
        });
    }
}

